﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Text;

namespace GetSmartIDEList.Lib.ORM
{
    public class ConnectionPool
    {
        /// <summary>
        /// 初始化。
        /// </summary>
        /// <param name="id">代码。</param>
        /// <param name="connection">数据库连接对象。</param>
        /// <param name="isUse">使用标志。</param>
        /// <param name="openTime">打开时间。</param>
        public ConnectionPool(Guid id, OleDbConnection connection, bool isUse, DateTime openTime)
        {
            this.id = id;
            IsUse = isUse;
            this.connection = connection;
            OpenTime = openTime;
        }

        private Guid id;

        /// <summary>
        /// 获取连接对象的代码
        /// </summary>
        public Guid Id { get { return id; } }

        private OleDbConnection connection;

        /// <summary>
        /// 获取数据库连接对象。
        /// </summary>

        public OleDbConnection Connection { get { return connection; } }


        /// <summary>
        /// 获取或设置一个值，该值指示连接对象是否已经使用，true-已经使用，否则没有使用。
        /// </summary>
        public bool IsUse { get; set; }


        /// <summary>
        /// 获取或设置连接对象打开数据库的时间
        /// </summary>

        public DateTime OpenTime { get; set; }
    }
}
